services:
  notifications-service:
    container_name: 'boticord-notifications'
    restart: on-failure
    env_file:
      - .env
    image: boticord/notifications-service:latest
    build:
      context: .
      dockerfile: Dockerfile
      target: notifications
  resources-service:
    container_name: 'boticord-resources'
    restart: on-failure
    env_file:
      - .env
    image: boticord/resources-service:latest
    build:
      context: .
      dockerfile: Dockerfile
      target: resources
  mysql:
    container_name: 'mysql'
    restart: on-failure
    env_file:
      - .env
    image: mysql
  migrator:
    container_name: 'migrator'
    restart: on-failure
    depends_on:
      - postgres
      - mysql
    env_file:
      - .env
    image: boticord/migrator-service:latest
    build:
      context: .
      dockerfile: Dockerfile
      target: migrator
  search-service:
    container_name: 'boticord-search'
    restart: on-failure
    depends_on:
      - meili
    env_file:
      - .env
    image: boticord/search-service:latest
    build:
      context: .
      dockerfile: Dockerfile
      target: search
  bot-service:
    container_name: 'boticord-bot'
    depends_on:
      - postgres
    env_file:
      - .env
    image: boticord/bot:latest
    build:
      dockerfile: Dockerfile
      context: .
      target: bot
  cdn-service:
    container_name: 'cdn-bot'
    depends_on:
      - postgres
    env_file:
      - .env
    image: boticord/cdn:latest
    build:
      dockerfile: Dockerfile
      context: .
      target: cdn
  users-service:
    container_name: 'boticord-users-service'
    restart: on-failure
    depends_on:
      - postgres
    env_file:
      - .env
    image: boticord/users-service:latest
    build:
      dockerfile: Dockerfile
      context: .
      target: users
  redisinsight:
    container_name: 'redis-insight'
    image: redislabs/redisinsight
    volumes:
      - redisinsight:/app
    restart: on-failure
  redis:
    container_name: 'boticord-redis'
    image: redis
    restart: on-failure
    command: --save 60 1
    volumes:
      - redis:/data
  portainer:
    image: portainer/portainer-ce
    container_name: 'boticord-portainer'
    restart: on-failure
    security_opt:
      - no-new-privileges:true
    volumes:
      - /etc/localtime:/etc/localtime:ro
      - /var/run/docker.sock:/var/run/docker.sock:ro
      - portainer-data:/data
    ports:
      - 127.0.0.1:8941:9000
  adminer:
    container_name: 'boticord-adminer'
    depends_on:
      - postgres
    image: adminer
    restart: on-failure
    ports:
      - 8942:8080

  meili:
    container_name: 'boticord-meili'
    image: getmeili/meilisearch:v1.1.1
    restart: on-failure
    ports:
      - 127.0.0.1:8943:7700
    volumes:
      - meili:/meili_data
    env_file:
      - .env
    environment:
      MEILI_NO_ANALYTICS: true
  nats:
    container_name: 'boticord-nats'
    image: nats
    restart: on-failure
    ports:
      - 127.0.0.1:8944:8222
      - 127.0.0.1:4222:4222
  postgres:
    container_name: 'boticord-postgres'
    image: postgres
    restart: on-failure
    environment:
      POSTGRES_PASSWORD: 123
      POSTGRES_USER: postgres
      POSTGRES_DB: boticord
    volumes:
      - postgres:/var/lib/postgresql/data

  nginx:
    image: nginx
    container_name: 'boticord-nginx'
    restart: on-failure
    volumes:
      - ./nginx.conf:/etc/nginx/templates/nginx.conf.template
    ports:
      - 80:80
    environment:
      NGINX_ENVSUBST_OUTPUT_DIR: /etc/nginx
    env_file:
      - ./.env

  hoppscotch:
    container_name: 'boticord-hoppscotch'
    image: hoppscotch/hoppscotch:latest
    restart: on-failure
    ports:
      - 127.0.0.1:8945:3000

volumes:
  postgres:
  portainer-data:
  meili:
  redisinsight:
  redis:
